package com.bems.action;

import java.util.HashMap;
import java.util.Map;

import com.bems.jdbc.common.DBManager;
import com.bems.pojo.POJO;
import com.bems.pojo.WareHouse;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import cn.org.ape.BaseAction;

public class WareHouseAction extends BaseAction
{
		private WareHouse warehouse;
   public void show()
         {
				WareHouse ware = new WareHouse().get(1);
				Gson gson = new Gson();
				JsonElement element =gson.toJsonTree(ware);
				JsonObject jsonObject = element.getAsJsonObject();
				jsonObject.addProperty("success", true);
				jsonObject.addProperty("id", ware.getId());
				DBManager.closeConnection();
		
				printJson(jsonObject.toString());
		}
   
    public void update() 
    		{
			 Map<String, Object> map = new HashMap<String, Object>();
			 map.put("adderss", warehouse.getAdderss());
			 map.put("name", warehouse.getName());
			 map.put("contact", warehouse.getContact());
			 map.put("note", warehouse.getNote());
			 map.put("linkman", warehouse.getLinkman());
			 new WareHouse().update(map , Long.parseLong(1+""));
			 
			 String json="{success:true}";
			 DBManager.closeConnection();
    	printJson(json);
			}

	public WareHouse getWarehouse() {
		return warehouse;
	}

	public void setWarehouse(WareHouse warehouse) {
		this.warehouse = warehouse;
	}
		
		   
}
